Skip to content

dns: add a new RUST-based DNS resolver extension#44090

Open
agrawroh wants to merge 4 commits intoenvoyproxy:mainfrom
agrawroh:feat-hick-dns
Open

dns: add a new RUST-based DNS resolver extension#44090
agrawroh wants to merge 4 commits intoenvoyproxy:mainfrom
agrawroh:feat-hick-dns

Conversation

@agrawroh
Copy link
Copy Markdown
Member

@agrawroh agrawroh commented Mar 23, 2026

Description

This PR adds a new RUST-based DNS resolver extension to Envoy.


Commit Message: dns: add a new RUST-based DNS resolver extension
Additional Description: Added a new RUST-based DNS resolver extension to Envoy.
Risk Level: Low
Testing: Added Tests
Docs Changes: Added
Release Notes: Added

@repokitteh-read-only
Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #44090 was opened by agrawroh.

see: more, trace.

@agrawroh agrawroh force-pushed the feat-hick-dns branch 3 times, most recently from e720a35 to fd827fd Compare March 23, 2026 17:58
@agrawroh agrawroh marked this pull request as ready for review March 23, 2026 20:43
@repokitteh-read-only repokitteh-read-only bot added api deps Approval required for changes to Envoy's external dependencies labels Mar 23, 2026
@agrawroh
Copy link
Copy Markdown
Member Author

/gemini review

@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @mattklein123
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).
CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to (bazel/.*repos.*\.bzl)|(bazel/dependency_imports\.bzl)|(api/bazel/.*\.bzl)|(.*/requirements\.txt)|(.*\.patch).
envoyproxy/dependency-shepherds assignee is @moderation

🐱

Caused by: #44090 was ready_for_review by agrawroh.

see: more, trace.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Rust-based DNS resolver extension, Hickory, which is a great addition. The implementation is comprehensive, including the core logic in Rust, the C++ shell, ABI definitions, build system changes, documentation, and tests.

My review has identified two main issues:

  1. A large, unrelated Tracer ABI definition has been included in source/extensions/dynamic_modules/abi/abi.h. This should be removed.
  2. There's a bug in the DNS-over-HTTPS configuration logic in the Rust implementation that prevents using hostnames in DoH URLs.

Apart from these points, the changes look solid. The C++ shell and Rust SDK are well-designed for thread safety and proper resource management.

@agrawroh
Copy link
Copy Markdown
Member Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Rust-based DNS resolver extension, Hickory, to Envoy. This is a substantial and well-executed feature, including a new dynamic module ABI for DNS resolvers, a Rust SDK for this ABI, the C++ shell for the extension, and the Rust implementation of the resolver logic. The code is well-structured, documented, and comes with comprehensive unit and integration tests. My review identified a critical issue in the new Rust SDK module where FFI functions are not panic-safe. Panics from user code could unwind across the FFI boundary, leading to undefined behavior and process crashes. I have provided comments with code suggestions to wrap the FFI calls with catch_unwind to ensure safety, consistent with other parts of the dynamic module SDK.

@agrawroh agrawroh force-pushed the feat-hick-dns branch 2 times, most recently from b5cc9d9 to 377e75f Compare March 24, 2026 06:25
@agrawroh
Copy link
Copy Markdown
Member Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Rust-based DNS resolver, Hickory, as a dynamic module. This is a significant and well-executed addition, providing modern DNS features like DNS-over-TLS, DNS-over-HTTPS, and DNSSEC. The implementation is thoughtfully split between a C++ shell and a Rust module, communicating via a new, well-documented DNS resolver ABI. The changes are extensive, touching API definitions, build systems, documentation, and adding new implementation and test files. The C++/Rust interaction, particularly the threading and shutdown logic, appears robust. The tests are comprehensive, covering both unit and integration scenarios. I have one suggestion to enhance configuration validation in the Rust module.

@agrawroh agrawroh force-pushed the feat-hick-dns branch 2 times, most recently from af8efcb to 41d196c Compare March 25, 2026 08:32
This was referenced Mar 25, 2026
Signed-off-by: Rohit Agrawal <rohit.agrawal@databricks.com>
Copy link
Copy Markdown
Member

@mathetake mathetake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one thing is that we should have exactly one cargo.toml that produces the .a archive for static Rust-based extensions, otherwise we would end up having multiple copies of Rust stdlibs (or i think the linker will fail once we have multiple objects).

@agrawroh
Copy link
Copy Markdown
Member Author

one thing is that we should have exactly one cargo.toml that produces the .a archive for static Rust-based extensions, otherwise we would end up having multiple copies of Rust stdlibs (or i think the linker will fail once we have multiple objects).

Yeah, I was trying to do that but couldn't make it work. Let me try again and see if I can get it to work.

srcs = ["hickory_dns.rs"],
edition = "2021",
deps = [
"//source/extensions/dynamic_modules/sdk/rust:envoy_proxy_dynamic_modules_rust_sdk",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this will still result in the conflict i believe. What i meant in the previous comment was that we should have exactly one rust_static_library in the envoy repo for all the rust based static extensions and then use the symbol prefixing stuff already existing in the dynamic_modules.bzl.

Then, on the extension wiring side, in this case hickory_dns_impl.cc, you can use the dynamic_modules.h API to load the module.

In other words I think we should have the crate at source/dynamic_modules/builtin_extensions (or whatever naming) and having the rust implementations there in a central place (that would be helpful in development too i think regarding language server etc). Then let's have the rust_static_library there so we can ensure only one Rust stdlib as well as any other dependencies would be shared (notably helpful for having the consistent logging library too). After that, you can bring in the rust_static_library here in this extension wiring side

Copy link
Copy Markdown
Member

@mathetake mathetake Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and then let's add the central crate here

members = ["source/extensions/dynamic_modules/sdk/rust", "test/extensions/dynamic_modules/test_data/rust"]
then we can simply clone envoy repo to have a full Rust completion etc on IDE as well as cargo test etc should work from the root of the repo

…k-dns

Signed-off-by: Rohit Agrawal <rohit.agrawal@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api deps Approval required for changes to Envoy's external dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants